home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / lib / surfr.pro < prev    next >
Text File  |  1997-07-08  |  2KB  |  75 lines

  1. ; $Id: surfr.pro,v 1.2 1997/01/15 03:11:50 ali Exp $
  2. ;
  3. ; Copyright (c) 1988-1997, Research Systems, Inc.  All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5.  
  6. pro surfr,ax=ax, az=az    ;Set up transformation for surface
  7. ;+
  8. ; NAME:
  9. ;    SURFR
  10. ;
  11. ; PURPOSE:
  12. ;    Set up 3D transformations.
  13. ;
  14. ;    This procedure duplicates the rotation, translation, and scaling 
  15. ;    features of the SURFACE routine.
  16. ;
  17. ; CATEGORY:
  18. ;    Graphics, 3D.
  19. ;
  20. ; CALLING SEQUENCE:
  21. ;    SURFR [, AX = ax]  [, AZ = az]
  22. ;
  23. ; INPUTS:
  24. ;    No plain parameters.
  25. ;
  26. ; KEYWORD PARAMETERS:
  27. ;    AX:    Angle of rotation about the X axis.  The default is 30 degrees.
  28. ;
  29. ;    AZ:    Angle of rotation about the Z axis.  The default is 30 degrees.
  30. ;
  31. ; OUTPUTS:
  32. ;    No explicit outputs.  Results are stored in !P.T.
  33. ;
  34. ; COMMON BLOCKS:
  35. ;    None.
  36. ;
  37. ; SIDE EFFECTS:
  38. ;    The 4 by 4 matrix, !P.T, the 3D transformation system variable, 
  39. ;    receives the homogeneous transformation matrix generated by this 
  40. ;    procedure.
  41. ;
  42. ; RESTRICTIONS:
  43. ;    Axonometric projections only.
  44. ;
  45. ; PROCEDURE:
  46. ;    1. Translate the unit cube so that the center (.5,.5,.5) is moved
  47. ;       to the origin.
  48. ;
  49. ;    2. Rotate -90 degrees about the X axis to make the +Z
  50. ;       axis of the data the +Y axis of the display.  The +Y data axis
  51. ;       extends from the front of the display to the rear.
  52. ;
  53. ;    3. Rotate about the Y axis AZ degrees.  This rotation is 
  54. ;       counterclockwise as seen from above the page.
  55. ;
  56. ;    4. Rotate about the X axis AX degrees, tilting the data
  57. ;       toward the viewer.
  58. ;
  59. ;    5. Translate back to the origin and scale the data so
  60. ;       that the data are still contained within the unit cube after
  61. ;       transformation.  This step uses the user procedure SCALE3D.
  62. ;
  63. ; MODIFICATION HISTORY:
  64. ;    DMS, may, 1988.
  65. ;-
  66. on_error,2                      ;Return to caller if an error occurs
  67. if n_elements(ax) eq 0 then ax=30
  68. if n_elements(az) eq 0 then az=30
  69.  
  70. t3d,/reset,tr=[-.5,-.5,-.5]    ;Translate to center about origin
  71. t3d,ro=[-90,az,0]        ;rotate so +Z axis is now +Y
  72. t3d,ro=[ax,0,0]
  73. scale3d                ;Scale it
  74. end
  75.